package com.ctrip.ec.biz.dao.ad;
import com.ctrip.ec.dal.DaoBase;
import com.ctrip.ec.biz.entity.ad.AdEntity;
import com.ctrip.ec.dal.DbAccess;
import com.ctrip.ec.dal.IdConvert;
import org.springframework.stereotype.Service;

import java.sql.SQLException;
import java.util.List;

@Service
public class AdDao extends DaoBase<AdEntity> {
    public AdDao() {
        super(AdEntity.class);
    }
    public AdDao(DbAccess db) {
        super(AdEntity.class,db);
    }

    public List<Long> getImageIds(List<Long> ids) throws SQLException {
        String sql = "select image_id from " + this.getTableName() + " where id in (" + IdConvert.join(ids) + ")";
        List<Long> imageIds = this.db.query(Long.class,sql);
        return imageIds;
    }
}
